import App from './App'
import store from './store'
import { createSSRApp } from 'vue'

// 判断是否登录
function ckeckLogin() {
	if (store.state.user.userInfo === null) {
	  uni.showToast({
	    title: '请先登录',
	    icon: 'none'
	  })
	  uni.switchTab({
	    url: '/pages/myself/index'
	  })
	  return false
	}
	return true;
}

export function createApp() {
  const app = createSSRApp(App)
  app.use(store)
  app.config.globalProperties.$showAd = true;	//是否显示广告
  app.config.globalProperties.$ckeckLogin = ckeckLogin;
  return { 
    app
  }
}

